/**
 * 渲染购物车内内容至页面
 */
let cartlist = typeof localStorage.cartList =='undefined'?[]:JSON.parse(localStorage.cartList);
let buylist = typeof localStorage.buyList =='undefined'?[]:JSON.parse(localStorage.buyList);

+function(){
    let html = '';
    cartlist.forEach((item,index)=>{
        buylist.forEach((ele,i)=>{
            if(ele.goodsId==item.goodsId){
                buylist[i] = item;
                let box = `<tr>
                                <td><input type="checkbox"></td>
                                <td>${item.goodsId}</td>
                                <td class="goodsImg"><img src="${item.imgUrl}"></td>
                                <td class="goodsDesc" style="text-align: left">${item.title}</td>
                                <td>￥<span>${parseInt(item.price).toFixed(2)}</span></td>
                                <td>
                                    <div class="goodsAccount">
                                        <a>-</a>
                                        <input type="text" value='${item.goodsNum}'>
                                        <a>+</a>
                                    </div>
                                </td>
                                <td>删除</td>
                            </tr>`
                html += box;
            }
        })
    })
    console.log($("tbody"))
    $("tbody").html(html)
    console.log(buylist)
}()